<template>
  <el-card class="box-card" shadow="always">
   <div class="title">对战管理平台</div>
	 <div class="login-form">
		 	<div class="username_wrapper">
				 <span class="username">用户名：</span>
				 <el-input
      	  placeholder="username"
      	  suffix-icon="el-icon-user"
					v-model="username"
      	/>
			</div>
			<div class="password_wrapper">
				<span class="password">密码：</span>
				<el-input placeholder="password" show-password suffix-icon="el-icon-key" v-model="password" />
			</div>
			<div class="btn">
				<el-button type="info" @click="login">登陆</el-button>
			</div>
	 </div>
  </el-card>
</template>

<script>
/* eslint-disable */
export default {
  name: 'Login',
  data () {
    return {
      username: 'zs',
      password: '123'
    }
  },
  methods: {
    login () {
      if (this.username === 'zs' && this.password === '123') {
				localStorage.setItem('vs_token', this.username)
        this.$router.push({ name: 'Home' })
				let timer = setTimeout(() => {
					localStorage.removeItem('vs_token')
					timer && clearTimeout(timer)
				}, 1000 * 60 * 10)
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.box-card {
	box-sizing: border-box;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 480px;
	height: 480px;
	.title {
		font-size: 30px;
		font-weight: 700;
		margin: 20px 0 40px 0;
	}
	.login-form {
		padding: 20px 0;
		.username_wrapper {
			display: flex;
			padding: 0 0 40px 0;
			align-items: center;
			.username {
				flex-shrink: 0;
			}
		}
		.password_wrapper {
			display: flex;
			padding: 0 0 40px 0;
			align-items: center;
			.password {
				flex-shrink: 0;
				margin-right: 15px;
			}
		}
	}
}
</style>
